Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFS] Added coordinated doc migration to RFS Worker #708

Merged
merged 3 commits into from
Jun 10, 2024

Conversation

chelma
Copy link
Member

@chelma chelma commented Jun 8, 2024

Description

  • Added initial implementation of decentralized, coordinated document migration to the RFS Worker

Issues Resolved

Testing

  • Added/ran unit tests
  • Performed successful migrations using local Docker Compose setup:
chelma@3c22fba4e266 RFS % gradle runRfsWorker --args='--snapshot-name reindex-from-snapshot --s3-local-dir /tmp/s3_files --s3-repo-uri s3://chelma-iad-rfs-local-testing --s3-region us-east-1 --lucene-dir /tmp/lucene_files --source-host http://localhost:19200 --target-host http://localhost:29200 --min-replicas 0 --index-template-whitelist "my_index_template" --component-template-whitelist "my_component_template"'
.
.
.
> Task :RFS:runRfsWorker
11:24:33.905 INFO  Running RfsWorker
11:24:34.150 INFO  Checking if work remains in the Snapshot Phase...
11:24:34.794 INFO  Snapshot not yet completed, entering Snapshot Phase...
11:24:34.794 INFO  Snapshot CMS Entry not found, attempting to create it...
11:24:34.946 INFO  Snapshot CMS Entry created
11:24:34.946 INFO  Attempting to initiate the snapshot...
11:24:36.492 INFO  Snapshot repo registration successful
11:24:36.770 INFO  Snapshot reindex-from-snapshot creation initiated
11:24:36.770 INFO  Snapshot in progress...
11:24:37.051 INFO  Snapshot not finished yet; sleeping for 5 seconds...
11:24:42.134 INFO  Snapshot not finished yet; sleeping for 5 seconds...
11:24:47.215 INFO  Snapshot not finished yet; sleeping for 5 seconds...
11:24:52.435 INFO  Snapshot not finished yet; sleeping for 5 seconds...
11:24:57.551 INFO  Snapshot completed, exiting Snapshot Phase...
11:24:57.551 INFO  Snapshot Phase is complete
11:24:58.309 INFO  Checking if work remains in the Metadata Migration Phase...
11:24:58.317 INFO  Metadata Migration not yet completed, entering Metadata Phase...
11:24:58.318 INFO  Pulling the Metadata Migration entry from the CMS, if it exists...
11:24:58.323 INFO  Metadata Migration CMS Entry not found, attempting to create it...
11:24:58.381 INFO  Metadata Migration CMS Entry created
11:24:58.382 INFO  Setting the worker's current work item to be the Metadata Migration...
11:24:58.382 INFO  Work item set
11:24:58.382 INFO  Migrating the Templates...
11:24:59.529 INFO  Downloading file from S3: s3://chelma-iad-rfs-local-testing/index-0 to /tmp/s3_files/index-0
11:24:59.818 INFO  Downloading file from S3: s3://chelma-iad-rfs-local-testing/meta-PDS2RIFMRwic_QYyH30wZQ.dat to /tmp/s3_files/meta-PDS2RIFMRwic_QYyH30wZQ.dat
11:24:59.968 INFO  Transforming template: my_legacy_template
11:24:59.969 INFO  Transforming template: my_index_template
11:24:59.970 INFO  Transforming template: my_component_template
11:24:59.970 INFO  Setting Global Metadata
11:24:59.971 INFO  Setting Legacy Templates...
11:24:59.971 INFO  No Legacy Templates in specified whitelist
11:24:59.971 INFO  Setting Component Templates...
11:24:59.971 INFO  Setting Component Template: my_component_template
11:25:00.016 INFO  Setting Index Templates...
11:25:00.016 INFO  Setting Index Template: my_index_template
11:25:00.055 INFO  Templates migration complete
11:25:00.055 INFO  Updating the Metadata Migration entry to indicate completion...
11:25:00.072 INFO  Metadata Migration entry updated
11:25:00.072 INFO  Clearing the worker's current work item...
11:25:00.072 INFO  Work item cleared
11:25:00.072 INFO  Metadata Migration completed, exiting Metadata Phase...
11:25:00.072 INFO  Metadata Migration Phase is complete
11:25:00.074 INFO  Checking if work remains in the Index Migration Phase...
11:25:00.078 INFO  Index Migration not yet completed, entering Index Phase...
11:25:00.078 INFO  Pulling the Index Migration entry from the CMS, if it exists...
11:25:00.085 INFO  Index Migration CMS Entry not found, attempting to create it...
11:25:00.093 INFO  Index Migration CMS Entry created
11:25:00.094 INFO  Setting the worker's current work item to be creating the index work entries...
11:25:00.094 INFO  Work item set
11:25:00.094 INFO  Setting up the Index Work Items...
11:25:00.101 INFO  Downloading file from S3: s3://chelma-iad-rfs-local-testing/indices/VMvMr6xmQsW3JWkl7Ez0AQ/meta-EmOq-I8BUanwajb-xLGQ.dat to /tmp/s3_files/indices/VMvMr6xmQsW3JWkl7Ez0AQ/meta-EmOq-I8BUanwajb-xLGQ.dat
11:25:00.253 INFO  Creating Index Work Item for index: logs-221998
11:25:00.294 INFO  Downloading file from S3: s3://chelma-iad-rfs-local-testing/indices/vFxIDVWSRRGYWh_CRoDjsQ/meta-E2Oq-I8BUanwajb-xLGQ.dat to /tmp/s3_files/indices/vFxIDVWSRRGYWh_CRoDjsQ/meta-E2Oq-I8BUanwajb-xLGQ.dat
11:25:00.459 INFO  Creating Index Work Item for index: reindexed-logs
11:25:00.469 INFO  Downloading file from S3: s3://chelma-iad-rfs-local-testing/indices/VDwuYpleS-iRX3tzFPQ3cQ/meta-FGOq-I8BUanwajb-xLGQ.dat to /tmp/s3_files/indices/VDwuYpleS-iRX3tzFPQ3cQ/meta-FGOq-I8BUanwajb-xLGQ.dat
11:25:00.631 INFO  Creating Index Work Item for index: sonested
11:25:00.640 INFO  Downloading file from S3: s3://chelma-iad-rfs-local-testing/indices/2VdrqF-QRoiiPJDrMK3clA/meta-FWOq-I8BUanwajb-xLGQ.dat to /tmp/s3_files/indices/2VdrqF-QRoiiPJDrMK3clA/meta-FWOq-I8BUanwajb-xLGQ.dat
11:25:00.781 INFO  Creating Index Work Item for index: logs-231998
11:25:00.790 INFO  Downloading file from S3: s3://chelma-iad-rfs-local-testing/indices/bFvOISclRtSdLRMQPEiG6A/meta-FmOq-I8BUanwajb-xbEb.dat to /tmp/s3_files/indices/bFvOISclRtSdLRMQPEiG6A/meta-FmOq-I8BUanwajb-xbEb.dat
11:25:00.932 INFO  Creating Index Work Item for index: logs-191998
11:25:00.941 INFO  Downloading file from S3: s3://chelma-iad-rfs-local-testing/indices/urBnNHypTBa1oltieE7HEA/meta-F2Oq-I8BUanwajb-xbEb.dat to /tmp/s3_files/indices/urBnNHypTBa1oltieE7HEA/meta-F2Oq-I8BUanwajb-xbEb.dat
11:25:01.081 INFO  Creating Index Work Item for index: geonames
11:25:01.091 INFO  Downloading file from S3: s3://chelma-iad-rfs-local-testing/indices/pGhxMnoOSESnb5h2PaMfCQ/meta-GGOq-I8BUanwajb-xbEc.dat to /tmp/s3_files/indices/pGhxMnoOSESnb5h2PaMfCQ/meta-GGOq-I8BUanwajb-xbEc.dat
11:25:01.232 INFO  Creating Index Work Item for index: nyc_taxis
11:25:01.244 INFO  Downloading file from S3: s3://chelma-iad-rfs-local-testing/indices/6gYM7GuZTN-_zMoFeTRD5A/meta-GWOq-I8BUanwajb-xbEd.dat to /tmp/s3_files/indices/6gYM7GuZTN-_zMoFeTRD5A/meta-GWOq-I8BUanwajb-xbEd.dat
11:25:01.411 INFO  Creating Index Work Item for index: logs-201998
11:25:01.420 INFO  Downloading file from S3: s3://chelma-iad-rfs-local-testing/indices/x_iBYiNwTXy_D2MnU65qyw/meta-GmOq-I8BUanwajb-xbE4.dat to /tmp/s3_files/indices/x_iBYiNwTXy_D2MnU65qyw/meta-GmOq-I8BUanwajb-xbE4.dat
11:25:01.563 INFO  Creating Index Work Item for index: logs-181998
11:25:01.573 INFO  Downloading file from S3: s3://chelma-iad-rfs-local-testing/indices/GRoHSnkUT1i73z7a5sTkcg/meta-HGOq-I8BUanwajb-xbGr.dat to /tmp/s3_files/indices/GRoHSnkUT1i73z7a5sTkcg/meta-HGOq-I8BUanwajb-xbGr.dat
11:25:01.708 INFO  Creating Index Work Item for index: logs-241998
11:25:01.716 INFO  Downloading file from S3: s3://chelma-iad-rfs-local-testing/indices/NOEA5ZEhQeu5VDdiBeeIVQ/meta-G2Oq-I8BUanwajb-xbGr.dat to /tmp/s3_files/indices/NOEA5ZEhQeu5VDdiBeeIVQ/meta-G2Oq-I8BUanwajb-xbGr.dat
11:25:01.881 INFO  Creating Index Work Item for index: logs-211998
11:25:01.890 INFO  Finished setting up the Index Work Items.
11:25:01.890 INFO  Updating the Index Migration entry to indicate setup has been completed...
11:25:01.904 INFO  Index Migration entry updated
11:25:01.904 INFO  Clearing the worker's current work item...
11:25:01.904 INFO  Work item cleared
11:25:01.904 INFO  Pulling a list of indices to migrate from the CMS...
11:25:01.966 INFO  Pulled 10 indices to migrate:
11:25:01.966 INFO  [{"type":"INDEX_WORK_ITEM","name":"logs-211998","status":"NOT_STARTED","numAttempts":1,"numShards":5}, {"type":"INDEX_WORK_ITEM","name":"logs-241998","status":"NOT_STARTED","numAttempts":1,"numShards":5}, {"type":"INDEX_WORK_ITEM","name":"logs-231998","status":"NOT_STARTED","numAttempts":1,"numShards":5}, {"type":"INDEX_WORK_ITEM","name":"logs-201998","status":"NOT_STARTED","numAttempts":1,"numShards":5}, {"type":"INDEX_WORK_ITEM","name":"logs-221998","status":"NOT_STARTED","numAttempts":1,"numShards":5}, {"type":"INDEX_WORK_ITEM","name":"reindexed-logs","status":"NOT_STARTED","numAttempts":1,"numShards":5}, {"type":"INDEX_WORK_ITEM","name":"sonested","status":"NOT_STARTED","numAttempts":1,"numShards":1}, {"type":"INDEX_WORK_ITEM","name":"nyc_taxis","status":"NOT_STARTED","numAttempts":1,"numShards":1}, {"type":"INDEX_WORK_ITEM","name":"geonames","status":"NOT_STARTED","numAttempts":1,"numShards":5}, {"type":"INDEX_WORK_ITEM","name":"logs-191998","status":"NOT_STARTED","numAttempts":1,"numShards":5}]
11:25:01.966 INFO  Migrating current batch of indices...
11:25:01.967 INFO  Migrating index: logs-211998
11:25:02.196 INFO  Index logs-211998 created successfully
11:25:02.196 INFO  Forcefully updating the Index Work Item to indicate it has been completed...
11:25:02.208 INFO  Index Work Item updated
11:25:02.208 INFO  Migrating index: logs-241998
11:25:02.426 INFO  Index logs-241998 created successfully
11:25:02.426 INFO  Forcefully updating the Index Work Item to indicate it has been completed...
11:25:02.434 INFO  Index Work Item updated
11:25:02.434 INFO  Migrating index: logs-231998
11:25:02.680 INFO  Index logs-231998 created successfully
11:25:02.680 INFO  Forcefully updating the Index Work Item to indicate it has been completed...
11:25:02.689 INFO  Index Work Item updated
11:25:02.689 INFO  Migrating index: logs-201998
11:25:02.929 INFO  Index logs-201998 created successfully
11:25:02.929 INFO  Forcefully updating the Index Work Item to indicate it has been completed...
11:25:02.937 INFO  Index Work Item updated
11:25:02.937 INFO  Migrating index: logs-221998
11:25:03.219 INFO  Index logs-221998 created successfully
11:25:03.219 INFO  Forcefully updating the Index Work Item to indicate it has been completed...
11:25:03.228 INFO  Index Work Item updated
11:25:03.228 INFO  Migrating index: reindexed-logs
11:25:03.561 INFO  Index reindexed-logs created successfully
11:25:03.561 INFO  Forcefully updating the Index Work Item to indicate it has been completed...
11:25:03.572 INFO  Index Work Item updated
11:25:03.572 INFO  Migrating index: sonested
11:25:03.799 INFO  Index sonested created successfully
11:25:03.799 INFO  Forcefully updating the Index Work Item to indicate it has been completed...
11:25:03.808 INFO  Index Work Item updated
11:25:03.808 INFO  Migrating index: nyc_taxis
11:25:03.914 INFO  Index nyc_taxis created successfully
11:25:03.914 INFO  Forcefully updating the Index Work Item to indicate it has been completed...
11:25:03.920 INFO  Index Work Item updated
11:25:03.920 INFO  Migrating index: geonames
11:25:04.175 INFO  Index geonames created successfully
11:25:04.175 INFO  Forcefully updating the Index Work Item to indicate it has been completed...
11:25:04.185 INFO  Index Work Item updated
11:25:04.185 INFO  Migrating index: logs-191998
11:25:04.430 INFO  Index logs-191998 created successfully
11:25:04.431 INFO  Forcefully updating the Index Work Item to indicate it has been completed...
11:25:04.438 INFO  Index Work Item updated
11:25:04.438 INFO  Pulling a list of indices to migrate from the CMS...
11:25:04.472 INFO  Pulled 1 indices to migrate:
11:25:04.472 INFO  [{"type":"INDEX_WORK_ITEM","name":"logs-181998","status":"NOT_STARTED","numAttempts":1,"numShards":5}]
11:25:04.472 INFO  Migrating current batch of indices...
11:25:04.472 INFO  Migrating index: logs-181998
11:25:04.691 INFO  Index logs-181998 created successfully
11:25:04.691 INFO  Forcefully updating the Index Work Item to indicate it has been completed...
11:25:04.702 INFO  Index Work Item updated
11:25:04.702 INFO  Pulling a list of indices to migrate from the CMS...
11:25:04.732 INFO  Pulled 0 indices to migrate:
11:25:04.732 INFO  []
11:25:04.732 INFO  Marking the Index Migration as completed...
11:25:04.747 INFO  Index Migration marked as completed
11:25:04.747 INFO  Index Migration completed, exiting Index Phase...
11:25:04.747 INFO  Index Migration Phase is complete
11:25:04.759 INFO  Checking if work remains in the Documents Migration Phase...
11:25:04.765 INFO  Documents Migration not yet completed, entering Documents Phase...
11:25:04.765 INFO  Pulling the Documents Migration entry from the CMS, if it exists...
11:25:04.772 INFO  Documents Migration CMS Entry not found, attempting to create it...
11:25:04.779 INFO  Documents Migration CMS Entry created
11:25:04.780 INFO  Setting the worker's current work item to be creating the documents work entries...
11:25:04.780 INFO  Work item set
11:25:04.780 INFO  Setting up the Documents Work Items...
11:25:04.784 INFO  Index logs-221998 has 5 shards
11:25:04.785 INFO  Creating Documents Work Item for index: logs-221998, shard: 0
11:25:04.833 INFO  Creating Documents Work Item for index: logs-221998, shard: 1
11:25:04.842 INFO  Creating Documents Work Item for index: logs-221998, shard: 2
11:25:04.849 INFO  Creating Documents Work Item for index: logs-221998, shard: 3
11:25:04.856 INFO  Creating Documents Work Item for index: logs-221998, shard: 4
11:25:04.865 INFO  Index reindexed-logs has 5 shards
11:25:04.865 INFO  Creating Documents Work Item for index: reindexed-logs, shard: 0
11:25:04.872 INFO  Creating Documents Work Item for index: reindexed-logs, shard: 1
11:25:04.879 INFO  Creating Documents Work Item for index: reindexed-logs, shard: 2
11:25:04.886 INFO  Creating Documents Work Item for index: reindexed-logs, shard: 3
11:25:04.893 INFO  Creating Documents Work Item for index: reindexed-logs, shard: 4
11:25:04.900 INFO  Index sonested has 1 shards
11:25:04.901 INFO  Creating Documents Work Item for index: sonested, shard: 0
11:25:04.908 INFO  Index logs-231998 has 5 shards
11:25:04.908 INFO  Creating Documents Work Item for index: logs-231998, shard: 0
11:25:04.915 INFO  Creating Documents Work Item for index: logs-231998, shard: 1
11:25:04.923 INFO  Creating Documents Work Item for index: logs-231998, shard: 2
11:25:04.930 INFO  Creating Documents Work Item for index: logs-231998, shard: 3
11:25:04.938 INFO  Creating Documents Work Item for index: logs-231998, shard: 4
11:25:04.947 INFO  Index logs-191998 has 5 shards
11:25:04.947 INFO  Creating Documents Work Item for index: logs-191998, shard: 0
11:25:04.956 INFO  Creating Documents Work Item for index: logs-191998, shard: 1
11:25:04.963 INFO  Creating Documents Work Item for index: logs-191998, shard: 2
11:25:04.970 INFO  Creating Documents Work Item for index: logs-191998, shard: 3
11:25:04.980 INFO  Creating Documents Work Item for index: logs-191998, shard: 4
11:25:04.990 INFO  Index geonames has 5 shards
11:25:04.990 INFO  Creating Documents Work Item for index: geonames, shard: 0
11:25:04.998 INFO  Creating Documents Work Item for index: geonames, shard: 1
11:25:05.007 INFO  Creating Documents Work Item for index: geonames, shard: 2
11:25:05.016 INFO  Creating Documents Work Item for index: geonames, shard: 3
11:25:05.023 INFO  Creating Documents Work Item for index: geonames, shard: 4
11:25:05.036 INFO  Index nyc_taxis has 1 shards
11:25:05.036 INFO  Creating Documents Work Item for index: nyc_taxis, shard: 0
11:25:05.047 INFO  Index logs-201998 has 5 shards
11:25:05.047 INFO  Creating Documents Work Item for index: logs-201998, shard: 0
11:25:05.059 INFO  Creating Documents Work Item for index: logs-201998, shard: 1
11:25:05.067 INFO  Creating Documents Work Item for index: logs-201998, shard: 2
11:25:05.073 INFO  Creating Documents Work Item for index: logs-201998, shard: 3
11:25:05.080 INFO  Creating Documents Work Item for index: logs-201998, shard: 4
11:25:05.088 INFO  Index logs-181998 has 5 shards
11:25:05.088 INFO  Creating Documents Work Item for index: logs-181998, shard: 0
11:25:05.099 INFO  Creating Documents Work Item for index: logs-181998, shard: 1
11:25:05.106 INFO  Creating Documents Work Item for index: logs-181998, shard: 2
11:25:05.112 INFO  Creating Documents Work Item for index: logs-181998, shard: 3
11:25:05.119 INFO  Creating Documents Work Item for index: logs-181998, shard: 4
11:25:05.127 INFO  Index logs-241998 has 5 shards
11:25:05.127 INFO  Creating Documents Work Item for index: logs-241998, shard: 0
11:25:05.136 INFO  Creating Documents Work Item for index: logs-241998, shard: 1
11:25:05.145 INFO  Creating Documents Work Item for index: logs-241998, shard: 2
11:25:05.155 INFO  Creating Documents Work Item for index: logs-241998, shard: 3
11:25:05.162 INFO  Creating Documents Work Item for index: logs-241998, shard: 4
11:25:05.168 INFO  Index logs-211998 has 5 shards
11:25:05.168 INFO  Creating Documents Work Item for index: logs-211998, shard: 0
11:25:05.175 INFO  Creating Documents Work Item for index: logs-211998, shard: 1
11:25:05.181 INFO  Creating Documents Work Item for index: logs-211998, shard: 2
11:25:05.187 INFO  Creating Documents Work Item for index: logs-211998, shard: 3
11:25:05.194 INFO  Creating Documents Work Item for index: logs-211998, shard: 4
11:25:05.200 INFO  Finished setting up the Documents Work Items.
11:25:05.200 INFO  Updating the Documents Migration entry to indicate setup has been completed...
11:25:05.217 INFO  Documents Migration entry updated
11:25:05.218 INFO  Clearing the worker's current work item...
11:25:05.218 INFO  Work item cleared
11:25:05.218 INFO  Seeing if there are any docs left to migration according to the CMS...
11:25:05.259 INFO  Found some docs to migrate
11:25:05.259 INFO  Setting the worker's current work item to be migrating the docs...
11:25:05.259 INFO  Work item set
11:25:05.259 INFO  Migrating docs: Index logs-231998, Shard 4
11:25:05.269 INFO  Downloading file from S3: s3://chelma-iad-rfs-local-testing/indices/2VdrqF-QRoiiPJDrMK3clA/4/snap-PDS2RIFMRwic_QYyH30wZQ.dat to /tmp/s3_files/indices/2VdrqF-QRoiiPJDrMK3clA/4/snap-PDS2RIFMRwic_QYyH30wZQ.dat
11:25:05.647 INFO  Downloading blob files from S3: s3://chelma-iad-rfs-local-testing/indices/2VdrqF-QRoiiPJDrMK3clA/4/ to /tmp/s3_files/indices/2VdrqF-QRoiiPJDrMK3clA/4
11:25:06.114 INFO  Blob file download(s) complete
11:25:06.127 INFO  Unpacking - Blob Name: __4b4PLKxuTlKX46rkgU8ubw, Lucene Name: _0.cfe
11:25:06.132 INFO  Unpacking - Blob Name: v__p1pWx5Y-RqGwOaHAk_v7mA, Lucene Name: _0.si
11:25:06.133 INFO  Unpacking - Blob Name: __53GQOy2sSASnYjqZzKyNOg, Lucene Name: _0.cfs
11:25:06.133 INFO  Unpacking - Blob Name: v__s7n6mNOQTVScUK14w1mmuQ, Lucene Name: segments_3
11:25:06.271 INFO  186 documents found in the current Lucene index
11:25:06.307 INFO  186 documents in current bulk request
11:25:06.386 INFO  Reindexing completed for Index logs-231998, Shard 4
11:25:06.386 INFO  Docs migrated
11:25:06.386 INFO  Updating the Documents Work Item to indicate it has been completed...
11:25:06.396 INFO  Documents Work Item updated
11:25:06.396 INFO  Clearing the worker's current work item...
11:25:06.396 INFO  Work item cleared
11:25:06.396 INFO  Seeing if there are any docs left to migration according to the CMS...
11:25:06.435 INFO  Found some docs to migrate
11:25:06.435 INFO  Setting the worker's current work item to be migrating the docs...
11:25:06.435 INFO  Work item set
11:25:06.435 INFO  Migrating docs: Index logs-211998, Shard 1
11:25:06.436 INFO  Downloading file from S3: s3://chelma-iad-rfs-local-testing/indices/NOEA5ZEhQeu5VDdiBeeIVQ/1/snap-PDS2RIFMRwic_QYyH30wZQ.dat to /tmp/s3_files/indices/NOEA5ZEhQeu5VDdiBeeIVQ/1/snap-PDS2RIFMRwic_QYyH30wZQ.dat
11:25:06.566 INFO  Downloading blob files from S3: s3://chelma-iad-rfs-local-testing/indices/NOEA5ZEhQeu5VDdiBeeIVQ/1/ to /tmp/s3_files/indices/NOEA5ZEhQeu5VDdiBeeIVQ/1
11:25:07.131 INFO  Blob file download(s) complete
11:25:07.131 INFO  Unpacking - Blob Name: __wl7BjXmJR6OS2Fp420Q44g, Lucene Name: _2_Lucene84_0.doc
11:25:07.132 INFO  Unpacking - Blob Name: __Gu5jBH61R-GjOLbFuBIn8Q, Lucene Name: _2_Lucene84_0.tim
11:25:07.133 INFO  Unpacking - Blob Name: __fqwZoAL_Qb-BJpU-AENrrA, Lucene Name: _2.kdd
11:25:07.134 INFO  Unpacking - Blob Name: v__Ez8dAEIiSJ2XgDmBTNe2lA, Lucene Name: _2.si
11:25:07.135 INFO  Unpacking - Blob Name: __JFM5KXn3RVCmHTWVIXDMow, Lucene Name: _2.kdi
11:25:07.135 INFO  Unpacking - Blob Name: __Nt4tNz2KQyqS76DpcI34FA, Lucene Name: _2.fdm
11:25:07.136 INFO  Unpacking - Blob Name: __6uqWc5p0RWe3xORB5QmKAw, Lucene Name: _2_Lucene84_0.pos
11:25:07.137 INFO  Unpacking - Blob Name: __f0GU9SfFQS2aW3jJHjy5jg, Lucene Name: _2.fdt
11:25:07.138 INFO  Unpacking - Blob Name: __NN5gDJPcRUyTf-kIoAlAfQ, Lucene Name: _2_Lucene80_0.dvm
11:25:07.138 INFO  Unpacking - Blob Name: __jPpser4bTM6cAOQne2KUSw, Lucene Name: _2.kdm
11:25:07.139 INFO  Unpacking - Blob Name: __LwXmjAO6Sb2CzZgklGHwxw, Lucene Name: _2.fdx
11:25:07.140 INFO  Unpacking - Blob Name: v__BguOHjTnSMuqQbi6tcf1Bg, Lucene Name: segments_4
11:25:07.141 INFO  Unpacking - Blob Name: __j_IeTpASR4qSdU0xk4dYwg, Lucene Name: _2_Lucene84_0.tip
11:25:07.141 INFO  Unpacking - Blob Name: __UZjZBiM7Q1SYJ5UuyqQZVA, Lucene Name: _2.nvd
11:25:07.142 INFO  Unpacking - Blob Name: __h-DS4ACZRFC6N7c82k24Ag, Lucene Name: _2_Lucene80_0.dvd
11:25:07.142 INFO  Unpacking - Blob Name: __Hl7W0eusQ1-95vAN4JOzfQ, Lucene Name: _2.nvm
11:25:07.143 INFO  Unpacking - Blob Name: __MTb2H3k4TD203oaiuHi8xA, Lucene Name: _2.fnm
11:25:07.144 INFO  Unpacking - Blob Name: __vJxr2-G3QAW9muydRA562w, Lucene Name: _2_Lucene84_0.tmd
11:25:07.151 INFO  189 documents found in the current Lucene index
11:25:07.156 INFO  189 documents in current bulk request
11:25:07.204 INFO  Reindexing completed for Index logs-211998, Shard 1
11:25:07.204 INFO  Docs migrated
11:25:07.204 INFO  Updating the Documents Work Item to indicate it has been completed...
11:25:07.213 INFO  Documents Work Item updated
11:25:07.213 INFO  Clearing the worker's current work item...
11:25:07.213 INFO  Work item cleared
11:25:07.213 INFO  Seeing if there are any docs left to migration according to the CMS...
.
.
.
11:25:31.844 INFO  Found some docs to migrate
11:25:31.844 INFO  Setting the worker's current work item to be migrating the docs...
11:25:31.844 INFO  Work item set
11:25:31.844 INFO  Migrating docs: Index logs-221998, Shard 0
11:25:31.845 INFO  Downloading file from S3: s3://chelma-iad-rfs-local-testing/indices/VMvMr6xmQsW3JWkl7Ez0AQ/0/snap-PDS2RIFMRwic_QYyH30wZQ.dat to /tmp/s3_files/indices/VMvMr6xmQsW3JWkl7Ez0AQ/0/snap-PDS2RIFMRwic_QYyH30wZQ.dat
11:25:31.980 INFO  Downloading blob files from S3: s3://chelma-iad-rfs-local-testing/indices/VMvMr6xmQsW3JWkl7Ez0AQ/0/ to /tmp/s3_files/indices/VMvMr6xmQsW3JWkl7Ez0AQ/0
11:25:32.279 INFO  Blob file download(s) complete
11:25:32.279 INFO  Unpacking - Blob Name: __L8m4IBSWQbqVlY7Cq-zcQA, Lucene Name: _2_Lucene84_0.doc
11:25:32.280 INFO  Unpacking - Blob Name: __cmbCZfR0R3qG9Kp5gTi9lA, Lucene Name: _2_Lucene84_0.tim
11:25:32.281 INFO  Unpacking - Blob Name: __0CDoEUFuSSeCYHkbkm6I3w, Lucene Name: _2.kdd
11:25:32.281 INFO  Unpacking - Blob Name: v__T6YZ84wdRlmmka6q5CFerw, Lucene Name: _2.si
11:25:32.281 INFO  Unpacking - Blob Name: __5VLtQRm_RJqohMlfAWHSPQ, Lucene Name: _2.kdi
11:25:32.282 INFO  Unpacking - Blob Name: __550Kfdg8RUSdegxyePGyig, Lucene Name: _2.fdm
11:25:32.282 INFO  Unpacking - Blob Name: __ynZK7CjHRVKpj9xPGQu8KQ, Lucene Name: _2_Lucene84_0.pos
11:25:32.282 INFO  Unpacking - Blob Name: __q2XGJqXcQiii19fubfu-Ew, Lucene Name: _2.fdt
11:25:32.283 INFO  Unpacking - Blob Name: __uNay6-2aSUywntcBzUtYFA, Lucene Name: _2_Lucene80_0.dvm
11:25:32.283 INFO  Unpacking - Blob Name: __0zBY362ARSeSgIFaVZIU0w, Lucene Name: _2.kdm
11:25:32.284 INFO  Unpacking - Blob Name: __HUlODuY1QvKACKWvgre4wA, Lucene Name: _2.fdx
11:25:32.284 INFO  Unpacking - Blob Name: v__pQAUGyxXS76hzLWmQhUnWQ, Lucene Name: segments_4
11:25:32.284 INFO  Unpacking - Blob Name: __L7G47aQITXad6muhodIJxw, Lucene Name: _2_Lucene84_0.tip
11:25:32.285 INFO  Unpacking - Blob Name: __l-O15CIFQ82Vw_DGxXdpnw, Lucene Name: _2.nvd
11:25:32.285 INFO  Unpacking - Blob Name: __eV9Cs9O-TOS6FyLcY11slw, Lucene Name: _2_Lucene80_0.dvd
11:25:32.286 INFO  Unpacking - Blob Name: __5GMvIZf0StOPjgyLu6KL9g, Lucene Name: _2.nvm
11:25:32.286 INFO  Unpacking - Blob Name: __rHBtnu4yT6KIjfBnQcRj4w, Lucene Name: _2.fnm
11:25:32.287 INFO  Unpacking - Blob Name: __3AYZNMoLSm6v8k_eugONOw, Lucene Name: _2_Lucene84_0.tmd
11:25:32.292 INFO  190 documents found in the current Lucene index
11:25:32.293 INFO  190 documents in current bulk request
11:25:32.309 INFO  Reindexing completed for Index logs-221998, Shard 0
11:25:32.309 INFO  Docs migrated
11:25:32.309 INFO  Updating the Documents Work Item to indicate it has been completed...
11:25:32.316 INFO  Documents Work Item updated
11:25:32.316 INFO  Clearing the worker's current work item...
11:25:32.316 INFO  Work item cleared
11:25:32.316 INFO  Seeing if there are any docs left to migration according to the CMS...
11:25:32.386 INFO  No docs found to migrate
11:25:32.386 INFO  Marking the Documents Migration as completed...
11:25:32.397 INFO  Documents Migration marked as completed
11:25:32.397 INFO  Documents Migration completed, exiting Documents Phase...
11:25:32.397 INFO  Documents Migration Phase is complete

Check List

  • New functionality includes testing
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@chelma chelma changed the title Migrations 1752 [RFS] Added coordinated doc migration to RFS Worker Jun 8, 2024
Copy link

codecov bot commented Jun 8, 2024

Codecov Report

Attention: Patch coverage is 65.04630% with 151 lines in your changes missing coverage. Please review.

Project coverage is 63.35%. Comparing base (bf749f8) to head (b79d775).
Report is 38 commits behind head on main.

Current head b79d775 differs from pull request most recent head 9284537

Please upload reports for the commit 9284537 to get more accurate results.

Files Patch % Lines
.../src/main/java/com/rfs/cms/OpenSearchCmsEntry.java 0.00% 44 Missing ⚠️
...src/main/java/com/rfs/cms/OpenSearchCmsClient.java 2.38% 41 Missing ⚠️
...FS/src/main/java/com/rfs/worker/DocumentsStep.java 90.33% 17 Missing and 3 partials ⚠️
RFS/src/main/java/com/rfs/ReindexFromSnapshot.java 0.00% 12 Missing ⚠️
RFS/src/main/java/com/rfs/RunRfsWorker.java 0.00% 7 Missing ⚠️
...fs/version_es_6_8/ShardMetadataFactory_ES_6_8.java 0.00% 7 Missing ⚠️
...FS/src/main/java/com/rfs/DemoPrintOutSnapshot.java 0.00% 6 Missing ⚠️
...FS/src/main/java/com/rfs/common/ShardMetadata.java 50.00% 4 Missing ⚠️
...ain/java/com/rfs/common/SnapshotShardUnpacker.java 83.33% 4 Missing ⚠️
.../src/main/java/com/rfs/worker/DocumentsRunner.java 84.21% 2 Missing and 1 partial ⚠️
... and 2 more
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #708      +/-   ##
============================================
- Coverage     63.56%   63.35%   -0.21%     
- Complexity     1565     1579      +14     
============================================
  Files           216      220       +4     
  Lines          8414     9164     +750     
  Branches        758      793      +35     
============================================
+ Hits           5348     5806     +458     
- Misses         2666     2948     +282     
- Partials        400      410      +10     
Flag Coverage Δ
unittests 63.35% <65.04%> (-0.21%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@peternied peternied left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I am missing something about how document leases are different from the other leasing patterns we have, @chelma could you take a look at that comment thread?

Comment on lines +21 to +25
public DocumentsRunner(GlobalState globalState, CmsClient cmsClient, String snapshotName, IndexMetadata.Factory metadataFactory,
ShardMetadata.Factory shardMetadataFactory, SnapshotShardUnpacker unpacker, LuceneDocumentsReader reader,
DocumentReindexer reindexer) {
this.members = new DocumentsStep.SharedMembers(globalState, cmsClient, snapshotName, metadataFactory, shardMetadataFactory, unpacker, reader, reindexer);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit; instead of piping these through as parameters, have a single parameter for DocumentsStep.SharedMembers instance

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, interesting - so are you thinking that the SharedMembers are a higher level abstraction rather than something just internal to the DocumentStep classes?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea I think so - since most members are not stateful so it seems like they could be part of a higher level construction for reuse.

And for Global state, I think I would recommend just removing it, seems like it represents a 'higher' step in, but the downstream systems don't seem to need to know where they are at save for a couple of log messages.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Steps set the Phase and Work Item in the GlobalState. These aren't used currently but have future uses per the design.

}

@Override
public void run() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the logic to pickup a lease only be used once before starting the work of DocumentStep? Why are we acquiring/updating the lease twice depending on CmsEntry.Documents vs CmsEntry.DocumentsWorkItem entry types?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's two different lease types for two different sets of work. The lease on a CmsEntry.Documents is used when you want to be the single node creating all the CmsEntry.DocumentsWorkItem in the CMS; the lease on the CmsEntry.DocumentsWorkItem is used when you want to be the single node migrating the documents associated with a specific shard.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If these are different phases, shouldn't they be different steps of the state machine for processing documents, it looks like they are conflated here. If it works lets go with it, but I think we will need to rework this area in the next pass

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe; this was all in the state machine we created/reviewed months ago. We'll have to look at it closely to see if it's desirable to actually split this out.

// We use optimistic locking here in the unlikely event someone else is working on this task despite the
// leasing system and managed to complete the task; in that case we want this update to bounce.
members.cmsWorkEntry = members.cmsClient.updateDocumentsWorkItem(updatedEntry, workItem);
members.cmsWorkEntry.ifPresentOrElse(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem correct, both of these log statements say 'failed', shouldn't one be success vs the other a warning?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! The second log statement should read "Unable to mark Documents Work Item ... as failed"; will fix. Regarding the log levels... I dunno about that one, it's tricky. I could see the case when we try and fail to mark it as failed be a warn? TBH, all the log levels could use a critical eye.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about creating a jira to revisit? Maybe meld this kind of detail check in with the instrumentation work, I suspect a refactor with common paths for logging all steps would greatly reduce the amount of bespoke log messages.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DocumentsStep.SetupDocumentsWorkEntries.class
),

// // We were able to acquire the lease, and it's on a Document Work Item setup
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete or uncomment?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oof, good catch. Will investigate.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete, thankfully

@@ -152,6 +163,13 @@ public static void main(String[] args) throws Exception {
IndexCreator_OS_2_11 indexCreator = new IndexCreator_OS_2_11(targetClient);
IndexRunner indexWorker = new IndexRunner(globalState, cmsClient, snapshotName, indexMetadataFactory, indexCreator, transformer);
indexWorker.run();

ShardMetadata.Factory shardMetadataFactory = new ShardMetadataFactory_ES_7_10(repoDataProvider);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you look into how SimpleRestoreFromSnapshot_ES_7_10 can be updated to use this code instead of the ad-hoc version? Seems like a great opportunity to reuse this system

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

100%, agreed. Will try to work into one of the small cleanup tasks I have next.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried to get this started, but seems like a refactor might be better to get this working: chelma/opensearch-migrations@main...peternied:documents-runner-test

Signed-off-by: Chris Helma <[email protected]>
@chelma chelma merged commit c1c4383 into opensearch-project:main Jun 10, 2024
5 checks passed
@chelma chelma deleted the MIGRATIONS-1752 branch June 10, 2024 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants